<?php

namespace app\index\controller;

class Index extends Common
{
    public function index()
    {
        $this->_empty();
    }
/*
 *  1	景点
    2	住宿
    3	风味
    4	民俗
    5	精品线路
    6	本地特产
    7	人文地标
 * */
    public function seek()
    {
        $uid = input('uid');
        $type = input('type');
        $name = input('name');
        if (empty($uid) || empty($name)) $this->rest('参数错误', 's004');
        $where =[];
        $where[] =['title','like', "%$name%"];
        if ($type) {
            $where[] = ['categories_id','=',$type];
            $order = '';
        }else{
            $order = ['categories_id'=>'desc','starttime'=>'desc'];
        }
        $art = db('article');
        $dyn = db('Dynamic');
        $field = 'id,title,images,address,words,abstract,uid,grade_status,score,look,grade_id,categories_id';
       // dump($where);
        $list = $art->field($field)->where($where)->order($order)->select();

        $field = 'id,uid,address,content,images,createtime,trialtime';
        $data = $dyn->field($field)->where('content','like',"%$name%")->select();

        p($data);
    }
}
